//
//  HttpRequest.m
//  RuiBenO2O
//
//  Created by LiYinDi on 14-10-14.
//  Copyright (c) 2014年 RuiBen. All rights reserved.
//

#import "HttpRequest.h"
#import "HttpBaseModel.h"

@implementation HttpRequest
+(void)requestData:(NSString *)dataPath params:(NSMutableDictionary *)params success:(void(^)(BOOL isSuccess,SeverData *severDataDict))success
{
    [Global setIfShowTextHudStr:@"Y"];
    [HttpBaseModel severRequest:dataPath params:params onCompletion:^(NSDictionary *responseData)
     {
         SeverData *dataContent=[[SeverData alloc] init];
         dataContent.dataDict=responseData;
         success(YES,dataContent);
     }
      onError:^(NSString *error)
     {
         SeverData *dataContent=[[SeverData alloc] init];
         dataContent.resultStr=error;
        // NSLog(@"error.localizedDescription===%@",error);
         success(NO,dataContent);
     }];
}
+(void)cancelRequest
{
    [Global setIfShowTextHudStr:@"N"];
    [HttpBaseModel stopRequest];
   
     
}
+(void)requestBarCodeData:(NSString *)dataPath params:(NSMutableDictionary *)params success:(void(^)(BOOL isSuccess,SeverData *severDataDict))success
{
    [HttpBaseModel severBarCodeRequest:dataPath params:params onCompletion:^(NSDictionary *responseData)
     {
         SeverData *dataContent=[[SeverData alloc] init];
         dataContent.dataDict=responseData;
         success(YES,dataContent);
     }
    onError:^(NSString *error)
     {
         SeverData *dataContent=[[SeverData alloc] init];
         dataContent.resultStr=error;
         //  NSLog(@"error.localizedDescription===%@",error);
         success(NO,dataContent);
     }];
}

+(void)requestLoginData:(NSString *)dataPath params:(NSMutableDictionary *)params success:(void(^)(BOOL isSuccess,SeverData *severDataDict))success
{
    [HttpBaseModel severLoginRequest:dataPath params:params onCompletion:^(NSDictionary *responseData)
     {
         SeverData *dataContent=[[SeverData alloc] init];
         dataContent.dataDict=responseData;
         success(YES,dataContent);
     }
                               onError:^(NSString *error)
     {
         SeverData *dataContent=[[SeverData alloc] init];
         dataContent.resultStr=error;
         //  NSLog(@"error.localizedDescription===%@",error);
         success(NO,dataContent);
     }];
}


@end
